<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AddSecondDeparmntsToFsCompanyUsers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('fs_company_users', function (Blueprint $table) {
            $table->string('supplierDepartmentId', 64)->default('')->comment('供应商的部门id（目前是供应商下的二级部门）');
            $table->string('supplierDepartmentName', 32)->default('')->comment('供应商部门名称');

            $table->index(['appId', 'supplierDepartmentId', 'supplierDepartmentName'], 'idx_supplierDepartments');
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('fs_company_users', function (Blueprint $table) {
            $table->dropColumn('supplierDepartmentId');
            $table->dropColumn('supplierDepartmentName');
            $table->dropIndex('idx_supplierDepartments');
        });
    }
}
